<?php
namespace app\mxty\controller;

use think\facade\Request;
use app\api\controller\Controller as ApiController;

use app\mxty\logic\Coach as CoachLogic;
use app\mxty\logic\Course as CourseLogic;

class Coach extends ApiController
{
    public function isCoach()
    {
        $isCoach = CoachLogic::isCoach();
        return $this->renderSuccess(compact('isCoach'));
    }

    // 获取教练的所有学员
    public function courseStudents()
    {
        // 这个是获取该教练所有的学员（去重）及每个学员的所有课程
        // $list = (new CourseLogic)->getCoachStudents();
        // 获取该教练所有课程及每个课程的所有学员信息
        $list = (new CourseLogic)->getAllCoursesWithStudent();
        return $this->renderSuccess($list);
    }
}
